import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ListComponent } from './components/list/list.component';
import { DetailsComponent } from './components/details/details.component';
import { DetailsService } from './services/details.service';
import { ListService } from './services/list.service';

const routes: Routes = [
  {
    path: '',
    data: {
      title: '区域中心',
    },
    children: [

      {
        path: '',
        component: ListComponent,
        runGuardsAndResolvers: 'always',
        resolve: {
          tree: ListService,
        },
       
      },
      {
        path: 'detail/:name',
        component: DetailsComponent,
        runGuardsAndResolvers: 'always',
        resolve: {
          zone: DetailsService,
        },
        data: {
          title: '区域详情',
        },
      },
      {
        path: 'permission/:name',
        loadChildren: 'app/modules/permission/permission.module#PermissionModule',
      },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class ZoneRoutingModule {}
